package com.zjbti.commonview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    private Button button,button2,button3;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button=findViewById(R.id.button);
        button2=findViewById(R.id.button2);
        button3=findViewById(R.id.button3);
        button3.setOnClickListener(this);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                button.setText("按钮1被点击");
            }
        });
    }

    public void click(View view) {
        button2.setText("按钮2被点击");
    }
    public void onClick(View v){
        switch (v.getId()){
            case R.id.button3:
                button3.setText("按钮3被点击");
                break;
        }
    }
}